<template>
<div>
 <el-form :inline="true">
     <el-form-item >
        <el-button
          type="primary"
          @click="flush"
          icon="export"
        >重新汇总</el-button>
      </el-form-item>
    </el-form>
  <BrowseDataList  :addQuery='addQuery' ref="datalist" :cols="cols"  :name="name"></BrowseDataList>
</div>
</template>
<script>
import { setSaveAfter2019 } from "@/api/案例分析.js";
import { showLoading, hideLoading } from "@/utils/loading"
import BrowseDataList from "@/components/BrowseDataList";
import { getUser } from "@/utils/auth";
import {get教学工作量} from "@/api/教学工作量"
import { get教师其他情况汇总} from "@/api/教师其他情况"
import {get教师基本情况ByGH,get教师基本情况} from "@/api/教师基本情况"
import linq from "linq"
export default {
  components: {
    BrowseDataList
  },
  data() {
    return {
      name:'6.4 教师工作量',
      addQuery:'',
      search_str:'',
        cols: [
        { label: "教工号", prop: "GH" },
          { label: "姓名", prop: "XM"} ,
         { label: "课程名称", prop: "KCMC"},
         { label: "总教学工作量（学时）", prop: "JXGZL"},
        ]

    };
  },
  created(){
    
    if(this.$route.query.param.教师性质=="校内专任")
    {
        this.addQuery='教师性质.contains("校内专任") or 教师性质=="其他" or 教师性质==null';
    }
    if(this.$route.query.param.教师性质=="校内兼课")
    {
        this.addQuery='教师性质.contains("校内兼课")  or 教师性质==null';
    }
     if(this.$route.query.param.教师性质=="校外兼职" )
    {
        this.addQuery='教师性质.contains("校外兼职") or 教师性质==null'
    }
     if(this.$route.query.param.教师性质=="校外兼课")
    {
          this.addQuery='教师性质.contains("校外兼课") or 教师性质==null'
    }
  },
  methods: {
    async flush() {
    try {
      showLoading();
      var user = getUser();
      await setSaveAfter2019(user.XXID, user.CJPC);
      hideLoading();
    } catch (e) {
      this.$alert(e);
    }
  },

 
    //   async fetchData() {
    //     var user = getUser()
    //     var datas = await get教学工作量(user.XXID,user.CJPC);
    //     var 教师 = await get教师基本情况(user.XXID,user.CJPC)
    //     var param = this.$route.query.param;
    //     教师 = linq.from(教师).where(`$.教师性质 == '${param.教师性质}'`).toArray()

    //     datas = linq.from(datas).join(教师,e=>e.GH,e=>e.GH,(outer,inner)=>{
    //     outer.BMMC=inner.BMMC;return outer}).toArray();
    //     return datas;
    // }
  }
};
</script>
<style>
</style>